/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quanlyduongsat;

import GUI.FrmHome;
import BUS.*;
import DAO.LanguagesController;
import DTO.*;
import GUI.*;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import log4j.Log4J;

/**
 *
 * @author Phong
 */
public class MainProgram extends javax.swing.JFrame {
static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(Log4J.class.getName());
    /**
     * Creates new form Main
     */
    //dùng để lưu lại danh sách các tab dang mở
    private ArrayList<DataTab> btn = new ArrayList();
    //icon close tab khi chưa rê chuột vào
    private final ImageIcon icon = new ImageIcon("src/Images/close.png");
    //icon close tab khi rê chuột vào
    private final ImageIcon iconhover = new ImageIcon("src/Images/close_hover.png");

    //form loading dữ liệu
    public class DataTab {

        private JButton btn;
        private int id;

        public DataTab() {
            this.btn = new JButton();
            id = 0;
        }

        public DataTab(JButton btn, int id) {
            this.btn = btn;
            this.id = id;
        }

        public JButton getBtn() {
            return this.btn;
        }

        public int getId() {
            return this.id;
        }
    }

    //Đóng 1 tab
    private void CloseTab(ActionEvent e) {
        //duyệt tất cả các tab đang mở
        for (int i = 0; i < btn.size(); i++) {
            //tìm tab vừa click vào. Nếu tìm thấy thì xóa tab đó khỏi tabmain
            if (e.getSource() == btn.get(i).getBtn()) {
                tabmain.remove(i);
                btn.remove(i);
                break;
            }
        }
    }

    //Đóng 1 tab
    public void CloseTab(int index) {
        tabmain.remove(index);
        btn.remove(index);
    }

    //sự kiện hover button close
    private void HoverButton(java.awt.event.MouseEvent evt, ImageIcon iin) {
        for (int i = 0; i < btn.size(); i++) {
            if (evt.getSource() == btn.get(i).getBtn()) {
                btn.get(i).getBtn().setIcon(iin);
                break;
            }
        }
    }

    private boolean KiemTraTab(int id) {
        for (int i = 0; i < btn.size(); i++) {
            if (btn.get(i).getId() == id) {
                //nếu đã được mở thì select vào tab đó
                tabmain.setSelectedIndex(i);
                return false;
            }
        }
        return true;
    }

    //tạo 1 tab mới
    public void createTab(String title, Component cpt, int id, String Username, String Group) {
        if(id!=0)
        {
            log.info("Xem@"+title+"@"+Username+"@"+Group);
        }
        //add 1 tab vào jTabbedPane1
        tabmain.addTab("", cpt);
        FlowLayout f = new FlowLayout(FlowLayout.CENTER, 5, 0);
        JPanel pnlTab = new JPanel(f);
        pnlTab.setOpaque(false);
        //tiêu đề tab
        JLabel lb = new JLabel(title);

        //button close
        JButton closeTab = new JButton();
        closeTab.setIcon(icon);
        closeTab.setToolTipText("Close Tab");
        closeTab.setOpaque(false);
        closeTab.setBorder(null);
        closeTab.setContentAreaFilled(false);
        closeTab.setFocusPainted(false);
        closeTab.setFocusable(false);

        pnlTab.add(lb);
        pnlTab.add(closeTab);
        btn.add(new DataTab(closeTab, id));
        tabmain.setTabComponentAt(tabmain.getTabCount() - 1, pnlTab);
        tabmain.setSelectedIndex(tabmain.getTabCount() - 1);

        //Sư kiện close tab
        closeTab.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                CloseTab(e);
            }
        });

        //Sự kiện hover
        closeTab.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                HoverButton(evt, iconhover);
            }

            @Override
            public void mouseExited(java.awt.event.MouseEvent evt) {
                HoverButton(evt, icon);
            }
        });

    }

    private void Time() {
        //tạo 1 luồng mới để luôn luôn chạy thời gian
        Thread th = new Thread(new TimeBLL(lbtime));
        th.start();
    }
    public UserList us = new UserList();
    String TenGroup;
    public MainProgram(UserList US) {
        initComponents();
        us = US;
        if (us.IdGroup.equals("NV")) {
            jMenuDanhMuc.setVisible(false);
        } else if (us.IdGroup.equals("KH")) {
            jMenuDanhMuc.setVisible(false);
            jMenuItemBanVe.setVisible(false);
            jMenuItemBaoCao.setVisible(false);
            jMenuItemTraCuu.setVisible(false);
        } else if (us.IdGroup.equals("QL")) {

        }
         TenGroup = XuLyLinhTinhBUS.TenGroup(us.IdGroup);
        NguoiDung nd = new NguoiDung();
        nd = XuLyLinhTinhBUS.TimNguoiDung(String.valueOf(us.Id));
        jLabelTen.setText(us.UserName);
        jLabeChucVu.setText(TenGroup);
        jLabelHoTen.setText(nd.HoTen);
        jLabelNgaySinh.setText(nd.NgaySinh);
        jLabeGioiTinh.setText(nd.GioiTinh);
        //Tiêu đề của phần mềm
        setTitle("Quản Lý Đường Sắt V1.0");
        //mở rộng phần mềm
        setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);
        //tạo size bằng kích thước màn hình
        setSize(getMaximumSize());
        //tạo 1 tab mới
        //createTab("Trang Chủ", new FrmHome(), 0);
        //hiện thị thời gian
        Time();
        createTab("Tran chủ", new FrmHome(), 0,us.UserName,TenGroup);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jSplitPane1 = new javax.swing.JSplitPane();
        jPanelHeThong = new javax.swing.JPanel();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        pnlLogin = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabelTen = new javax.swing.JLabel();
        jLabeChucVu = new javax.swing.JLabel();
        jLabelHoTen = new javax.swing.JLabel();
        jLabelNgaySinh = new javax.swing.JLabel();
        jLabeGioiTinh = new javax.swing.JLabel();
        lbtime = new javax.swing.JLabel();
        jButton7 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        tabmain = new javax.swing.JTabbedPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem55 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuDanhMuc = new javax.swing.JMenu();
        jMenuDoiTuong = new javax.swing.JMenu();
        jMenuKhachHang = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuDoanTau = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuChiTietTau = new javax.swing.JMenu();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenuVe = new javax.swing.JMenuItem();
        jMenuQuiDinh = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenu9 = new javax.swing.JMenu();
        jMenuItem18 = new javax.swing.JMenuItem();
        jMenuItemBanVe = new javax.swing.JMenuItem();
        jMenuItem19 = new javax.swing.JMenuItem();
        jMenuItemBaoCao = new javax.swing.JMenuItem();
        jMenuItemTraCuu = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem21 = new javax.swing.JMenuItem();
        jMenuItem22 = new javax.swing.JMenuItem();
        jCheckBoxMenuItemHienThi = new javax.swing.JCheckBoxMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jPanelHeThong.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Hệ Thống", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 12))); // NOI18N
        jPanelHeThong.setEnabled(false);

        jButton5.setText("Ẩn ( << )");
        jButton5.setToolTipText("Ẩn ");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/19.png"))); // NOI18N
        jButton6.setText("Đăng Xuất");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        pnlLogin.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Thông Tin User", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 14))); // NOI18N
        pnlLogin.setPreferredSize(new java.awt.Dimension(377, 200));

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel1.setText("-Họ Tên:");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel3.setText("-Giới Tính:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel4.setText("-Tên User:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel5.setText("-Chức Vụ:");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel2.setText("-Ngày Sinh:");

        jLabelTen.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabelTen.setForeground(new java.awt.Color(255, 0, 0));
        jLabelTen.setText("jLabel6");

        jLabeChucVu.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabeChucVu.setForeground(new java.awt.Color(255, 0, 0));
        jLabeChucVu.setText("jLabel6");

        jLabelHoTen.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabelHoTen.setForeground(new java.awt.Color(255, 0, 0));
        jLabelHoTen.setText("jLabel6");

        jLabelNgaySinh.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabelNgaySinh.setForeground(new java.awt.Color(255, 0, 0));
        jLabelNgaySinh.setText("jLabel6");

        jLabeGioiTinh.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabeGioiTinh.setForeground(new java.awt.Color(255, 0, 0));
        jLabeGioiTinh.setText("jLabel6");

        javax.swing.GroupLayout pnlLoginLayout = new javax.swing.GroupLayout(pnlLogin);
        pnlLogin.setLayout(pnlLoginLayout);
        pnlLoginLayout.setHorizontalGroup(
            pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLoginLayout.createSequentialGroup()
                .addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addComponent(jLabelTen)
                    .addComponent(jLabel1)
                    .addComponent(jLabeChucVu)
                    .addComponent(jLabelHoTen)
                    .addComponent(jLabel2)
                    .addComponent(jLabelNgaySinh)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5)
                    .addComponent(jLabeGioiTinh)
                    .addComponent(lbtime, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlLoginLayout.setVerticalGroup(
            pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLoginLayout.createSequentialGroup()
                .addComponent(jLabel4)
                .addGap(1, 1, 1)
                .addComponent(jLabelTen)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel5)
                .addGap(3, 3, 3)
                .addComponent(jLabeChucVu)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelHoTen)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelNgaySinh, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabeGioiTinh)
                .addGap(49, 49, 49)
                .addComponent(lbtime, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/18.png"))); // NOI18N
        jButton7.setText("Thoát CT");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jButton1.setText("VN");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("EN");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelHeThongLayout = new javax.swing.GroupLayout(jPanelHeThong);
        jPanelHeThong.setLayout(jPanelHeThongLayout);
        jPanelHeThongLayout.setHorizontalGroup(
            jPanelHeThongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(pnlLogin, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
            .addGroup(jPanelHeThongLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanelHeThongLayout.setVerticalGroup(
            jPanelHeThongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelHeThongLayout.createSequentialGroup()
                .addComponent(jButton5)
                .addGap(23, 23, 23)
                .addComponent(jButton6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelHeThongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(pnlLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jSplitPane1.setLeftComponent(jPanelHeThong);
        jSplitPane1.setRightComponent(tabmain);

        jMenu1.setText("Hệ Thống");

        jMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/lock .png"))); // NOI18N
        jMenu2.setText("Bảo Mật");

        jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/good_or_tick.png"))); // NOI18N
        jMenuItem2.setText("Phân Quyền");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jMenuItem55.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/ic_arrow_round_change.png"))); // NOI18N
        jMenuItem55.setText("Đổi Mật Khẩu");
        jMenuItem55.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem55ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem55);

        jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/book_edit.png"))); // NOI18N
        jMenuItem6.setText("Nhật Kí Hệ Thống");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem6);

        jMenu1.add(jMenu2);

        jMenu5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/data_recovery.png"))); // NOI18N
        jMenu5.setText("Dữ Liệu");

        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/hard_drive_backups_2.png"))); // NOI18N
        jMenuItem4.setText("Sao Lưu");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem4);

        jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/data_transfer.png"))); // NOI18N
        jMenuItem5.setText("Phục Hồi");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem5);

        jMenu1.add(jMenu5);

        jMenuBar1.add(jMenu1);

        jMenuDanhMuc.setText("Danh Mục");

        jMenuDoiTuong.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/22.png"))); // NOI18N
        jMenuDoiTuong.setText("Đối Tượng");

        jMenuKhachHang.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/2.png"))); // NOI18N
        jMenuKhachHang.setText("Khách Hàng");
        jMenuKhachHang.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuKhachHangActionPerformed(evt);
            }
        });
        jMenuDoiTuong.add(jMenuKhachHang);

        jMenuItem7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/1.png"))); // NOI18N
        jMenuItem7.setText("Nhân Viên");
        jMenuItem7.setToolTipText("");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenuDoiTuong.add(jMenuItem7);

        jMenuDanhMuc.add(jMenuDoiTuong);

        jMenuDoanTau.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/23.png"))); // NOI18N
        jMenuDoanTau.setText("Đoàn Tàu");

        jMenuItem8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/3.png"))); // NOI18N
        jMenuItem8.setText("Tàu");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenuDoanTau.add(jMenuItem8);

        jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/4.png"))); // NOI18N
        jMenuItem9.setText("Toa");
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem9ActionPerformed(evt);
            }
        });
        jMenuDoanTau.add(jMenuItem9);

        jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/5.png"))); // NOI18N
        jMenuItem10.setText("Ghế");
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        jMenuDoanTau.add(jMenuItem10);

        jMenuItem11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/17.png"))); // NOI18N
        jMenuItem11.setText("Phòng");
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        jMenuDoanTau.add(jMenuItem11);

        jMenuDanhMuc.add(jMenuDoanTau);

        jMenuChiTietTau.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/24.png"))); // NOI18N
        jMenuChiTietTau.setText("Chi Tiết Tàu");

        jMenuItem12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/6.png"))); // NOI18N
        jMenuItem12.setText("Chuyến Tàu");
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem12ActionPerformed(evt);
            }
        });
        jMenuChiTietTau.add(jMenuItem12);

        jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/8.png"))); // NOI18N
        jMenuItem13.setText("Tuyến Tàu");
        jMenuItem13.setToolTipText("");
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenuChiTietTau.add(jMenuItem13);

        jMenuItem14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/7.png"))); // NOI18N
        jMenuItem14.setText("Hành Trình");
        jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem14ActionPerformed(evt);
            }
        });
        jMenuChiTietTau.add(jMenuItem14);

        jMenuDanhMuc.add(jMenuChiTietTau);

        jMenuVe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/9.png"))); // NOI18N
        jMenuVe.setText("Vé");
        jMenuVe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuVeActionPerformed(evt);
            }
        });
        jMenuDanhMuc.add(jMenuVe);

        jMenuQuiDinh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/12.png"))); // NOI18N
        jMenuQuiDinh.setText("Qui Định");
        jMenuQuiDinh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuQuiDinhActionPerformed(evt);
            }
        });
        jMenuDanhMuc.add(jMenuQuiDinh);

        jMenuBar1.add(jMenuDanhMuc);

        jMenu3.setText("Chức Năng");

        jMenu9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/25.png"))); // NOI18N
        jMenu9.setText("Đặt Vé ONLINE");

        jMenuItem18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/14.png"))); // NOI18N
        jMenuItem18.setText("Đặt Vé");
        jMenu9.add(jMenuItem18);

        jMenu3.add(jMenu9);

        jMenuItemBanVe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/13.png"))); // NOI18N
        jMenuItemBanVe.setText("Bán Vé");
        jMenuItemBanVe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemBanVeActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItemBanVe);

        jMenuItem19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/10.png"))); // NOI18N
        jMenuItem19.setText("Thanh Toán");
        jMenuItem19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem19ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem19);

        jMenuItemBaoCao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/15.png"))); // NOI18N
        jMenuItemBaoCao.setText("Báo Cáo");
        jMenuItemBaoCao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemBaoCaoActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItemBaoCao);

        jMenuItemTraCuu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/16.png"))); // NOI18N
        jMenuItemTraCuu.setText("Tra Cứu");
        jMenuItemTraCuu.setToolTipText("");
        jMenuItemTraCuu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemTraCuuActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItemTraCuu);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Trợ Giúp");

        jMenuItem21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/20.png"))); // NOI18N
        jMenuItem21.setText("Hướng Dẫn Sử Dụng");
        jMenuItem21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem21ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem21);

        jMenuItem22.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/21.png"))); // NOI18N
        jMenuItem22.setText("About");
        jMenu4.add(jMenuItem22);

        jCheckBoxMenuItemHienThi.setSelected(true);
        jCheckBoxMenuItemHienThi.setText("Hiện Thanh Hệ Thống");
        jCheckBoxMenuItemHienThi.setToolTipText("");
        jCheckBoxMenuItemHienThi.setAlignmentX(0.1F);
        jCheckBoxMenuItemHienThi.setAlignmentY(0.1F);
        jCheckBoxMenuItemHienThi.setAutoscrolls(true);
        jCheckBoxMenuItemHienThi.setIconTextGap(2);
        jCheckBoxMenuItemHienThi.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBoxMenuItemHienThiItemStateChanged(evt);
            }
        });
        jMenu4.add(jCheckBoxMenuItemHienThi);

        jMenuBar1.add(jMenu4);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1019, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
            .addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.LEADING)
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jCheckBoxMenuItemHienThiItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBoxMenuItemHienThiItemStateChanged

// TODO add your handling code here:
        if (evt.getStateChange() == ItemEvent.SELECTED) {
            jPanelHeThong.setVisible(true);
            jSplitPane1.setDividerLocation(140);
        } else {
            jPanelHeThong.setVisible(false);
        }

    }//GEN-LAST:event_jCheckBoxMenuItemHienThiItemStateChanged

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        // TODO add your handling code here:
//         NhanVienGUI frm = new NhanVienGUI();
//        tabmain.removeAll();
//        tabmain.add("Nhân Viên", frm);
//        
        if (KiemTraTab(7)) {
            createTab("Nhân Viên", new NhanVienGUI(), 7,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowOpened

    private void jMenuKhachHangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuKhachHangActionPerformed
        // TODO add your handling code here:
//          KhachHangGUI frm = new KhachHangGUI();
//        tabmain.removeAll();
//        tabmain.add("Khách Hàng", frm);
        if (KiemTraTab(6)) {
            createTab("Khách Hàng", new KhachHangGUI(), 6,us.UserName,TenGroup);
        }

    }//GEN-LAST:event_jMenuKhachHangActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
        // TODO add your handling code here:
     if (KiemTraTab(8)) {
            createTab("Đoàn Tàu", new TauGUI(), 8,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem8ActionPerformed

    private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed
        // TODO add your handling code here:
       if (KiemTraTab(9)) {
            createTab("Toa Tàu", new ToaGUI(), 9,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem9ActionPerformed

    private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed
        // TODO add your handling code here:
       if (KiemTraTab(10)) {
            createTab("Ghế Tàu", new GheGUI(), 10,us.UserName,TenGroup);
        }

    }//GEN-LAST:event_jMenuItem10ActionPerformed

    private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
        // TODO add your handling code here:
        if (KiemTraTab(11)) {
            createTab("Phòng Tàu", new PhongGUI(), 11,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem11ActionPerformed

    private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed
        // TODO add your handling code here:
     if (KiemTraTab(12)) {
            createTab("Chuyến Tàu", new ChuyenTauGUI(), 12,us.UserName,TenGroup);
        }

    }//GEN-LAST:event_jMenuItem12ActionPerformed

    private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed
        // TODO add your handling code here:
      if (KiemTraTab(13)) {
            createTab("Tuyến Tàu", new TuyenTauGUI(), 13,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem13ActionPerformed

    private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed
        // TODO add your handling code here:

       if (KiemTraTab(14)) {
            createTab("Hành Trình", new HanhTrinhGUI(), 14,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem14ActionPerformed

    private void jMenuVeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuVeActionPerformed
        // TODO add your handling code here:

      if (KiemTraTab(15)) {
            createTab("Vé", new VeGUI(), 15,us.UserName,TenGroup);
        }

    }//GEN-LAST:event_jMenuVeActionPerformed

    private void jMenuQuiDinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuQuiDinhActionPerformed
        // TODO add your handling code here:
       if (KiemTraTab(16)) {
            createTab("Quy Định", new QuyDinhGUI(), 16,us.UserName,TenGroup);
        }

    }//GEN-LAST:event_jMenuQuiDinhActionPerformed

    private void jMenuItemBaoCaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemBaoCaoActionPerformed
        if (KiemTraTab(20)) {
            createTab("Báo Cáo", new BaoCao(), 20,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItemBaoCaoActionPerformed
//hàm đóng form kinh điển.

    public void close() {

        WindowEvent winClosingEvent = new WindowEvent(this, WindowEvent.WINDOW_CLOS­ING);
        Toolkit.getDefaultToolkit().getSystemEve­ntQueue().postEvent(winClosingEvent);

    }
    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        close();
    }//GEN-LAST:event_jButton7ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        //jPanel1.setVisible(false);
        jCheckBoxMenuItemHienThi.setSelected(false);
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
    try {
        // TODO add your handling code here:
        this.dispose();
        DangNhapForm dn = new DangNhapForm();
        dn.setVisible(true);
    } catch (IOException ex) {
        Logger.getLogger(MainProgram.class.getName()).log(Level.SEVERE, null, ex);
    }


    }//GEN-LAST:event_jButton6ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        // TODO add your handling code here:
       if (KiemTraTab(5)) {
            createTab("Restore", new RestoreGUI(), 5,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem5ActionPerformed

  
    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:

    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        // TODO add your handling code here:
        if (KiemTraTab(4)) {
            createTab("Backup", new BackupGUI(), 4,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowClosed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        // TODO add your handling code here:
         if (KiemTraTab(3)) {
            createTab("Nhật Kí Hệ Thống", new NhatKyHeThong(), 3,us.UserName,TenGroup);
        }
    }//GEN-LAST:event_jMenuItem6ActionPerformed


    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {                                           
      
    }                                          


    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        LanguagesController langController_it = new LanguagesController("Italiano");
        jMenu1.setText(langController_it.getWord("system"));
        jMenu3.setText(langController_it.getWord("function"));
        jMenu4.setText(langController_it.getWord("help"));
        jMenuDanhMuc.setText(langController_it.getWord("list"));

        jButton5.setText(langController_it.getWord("hide"));
        jButton6.setText(langController_it.getWord("signout"));
        jButton7.setText(langController_it.getWord("exit"));
        jLabel5.setText(langController_it.getWord("positions"));
        jLabel3.setText(langController_it.getWord("gender"));

        //jLabelHoTen.setText(langController_it.getWord("name"));
        //jLabelNgaySinh.setText(langController_it.getWord("birthday"));
        jLabel4.setText(langController_it.getWord("username"));
        jMenu2.setText(langController_it.getWord("sercurity"));
        jMenuChiTietTau.setText(langController_it.getWord("shipdetail"));

        jMenu9.setText(langController_it.getWord("bookticketonline"));
        jMenuDoanTau.setText(langController_it.getWord("ships"));
        jMenuDoiTuong.setText(langController_it.getWord("objects"));
        jMenu5.setText(langController_it.getWord("data"));

        jMenuItemBanVe.setText(langController_it.getWord("buy"));
        jMenuItemBaoCao.setText(langController_it.getWord("report"));
        jMenuItem12.setText(langController_it.getWord("train"));
        jMenuItem18.setText(langController_it.getWord("book"));
        jMenuItem10.setText(langController_it.getWord("seat"));
        jMenuItem14.setText(langController_it.getWord("journey"));
        jMenuItem21.setText(langController_it.getWord("manual"));
        jMenuItem7.setText(langController_it.getWord("staff"));
        jMenuItem11.setText(langController_it.getWord("room"));
        jMenuItem5.setText(langController_it.getWord("restore"));
        jMenuItem4.setText(langController_it.getWord("backup"));
        jMenuItem8.setText(langController_it.getWord("ship"));
        jMenuItem19.setText(langController_it.getWord("payment"));
        jMenuItem9.setText(langController_it.getWord("carriages"));
        jMenuItemTraCuu.setText(langController_it.getWord("lookup"));
        jMenuItem13.setText(langController_it.getWord("lines"));
        jMenuKhachHang.setText(langController_it.getWord("custom"));
        jMenuQuiDinh.setText(langController_it.getWord("regulations"));

        jMenuVe.setText(langController_it.getWord("ticket"));
        jMenuItem2.setText(langController_it.getWord("userrole"));
        jMenuItem6.setText(langController_it.getWord("systemlog"));
        jMenuItem55.setText(langController_it.getWord("changepass"));

    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        LanguagesController langController_en = new LanguagesController("English");
        jMenu1.setText(langController_en.getWord("system"));
        jMenu3.setText(langController_en.getWord("function"));
        jMenu4.setText(langController_en.getWord("help"));
        jMenuDanhMuc.setText(langController_en.getWord("list"));

        jButton5.setText(langController_en.getWord("hide"));
        jButton6.setText(langController_en.getWord("signout"));
        jButton7.setText(langController_en.getWord("exit"));
        jLabel5.setText(langController_en.getWord("positions"));
        jLabel3.setText(langController_en.getWord("gender"));

        jLabel1.setText(langController_en.getWord("name"));
        jLabel2.setText(langController_en.getWord("birthday"));
        jLabel4.setText(langController_en.getWord("username"));
        jMenu2.setText(langController_en.getWord("sercurity"));
        jMenuChiTietTau.setText(langController_en.getWord("shipdetail"));

        jMenu9.setText(langController_en.getWord("bookticketonline"));
        jMenuDoanTau.setText(langController_en.getWord("ships"));
        jMenuDoiTuong.setText(langController_en.getWord("objects"));
        jMenu5.setText(langController_en.getWord("data"));

        jMenuItemBanVe.setText(langController_en.getWord("buy"));
        jMenuItemBaoCao.setText(langController_en.getWord("report"));
        jMenuItem12.setText(langController_en.getWord("train"));
        jMenuItem18.setText(langController_en.getWord("book"));
        jMenuItem10.setText(langController_en.getWord("seat"));
        jMenuItem14.setText(langController_en.getWord("journey"));
        jMenuItem21.setText(langController_en.getWord("manual"));
        jMenuItem7.setText(langController_en.getWord("staff"));
        jMenuItem11.setText(langController_en.getWord("room"));
        jMenuItem5.setText(langController_en.getWord("restore"));
        jMenuItem4.setText(langController_en.getWord("backup"));
        jMenuItem8.setText(langController_en.getWord("ship"));
        jMenuItem19.setText(langController_en.getWord("payment"));
        jMenuItem9.setText(langController_en.getWord("carriages"));
        jMenuItemTraCuu.setText(langController_en.getWord("lookup"));
        jMenuItem13.setText(langController_en.getWord("lines"));
        jMenuKhachHang.setText(langController_en.getWord("custom"));
        jMenuQuiDinh.setText(langController_en.getWord("regulations"));

        jMenuVe.setText(langController_en.getWord("ticket"));
        jMenuItem2.setText(langController_en.getWord("userrole"));
        jMenuItem6.setText(langController_en.getWord("systemlog"));
        jMenuItem55.setText(langController_en.getWord("changepass"));
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jMenuItemBanVeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemBanVeActionPerformed
       
                 if (KiemTraTab(18)) {
            createTab("Bán Vé", new BanVeGUI(us.UserName), 18,us.UserName,TenGroup);
            
        }
        
    }//GEN-LAST:event_jMenuItemBanVeActionPerformed

    private void jMenuItem55ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem55ActionPerformed
          if (KiemTraTab(2)) {
            createTab("Đổi Mật Khẩu", new DoiMatKhauGUI(us.UserName), 2,us.UserName,TenGroup);
          }
    }//GEN-LAST:event_jMenuItem55ActionPerformed

    private void jMenuItem19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem19ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem19ActionPerformed

    private void jMenuItemTraCuuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemTraCuuActionPerformed
       if (KiemTraTab(19)) {
            createTab("Tra Cứu", new TraCuuGUI(), 19,us.UserName,TenGroup);
          }
    }//GEN-LAST:event_jMenuItemTraCuuActionPerformed

    private void jMenuItem21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem21ActionPerformed
       String fileName = "trogiup.chm";
    String[] commands = {"cmd", "/c", fileName};
    try {
    Runtime.getRuntime().exec(commands);
    } catch (Exception ex) {
    ex.printStackTrace();
    }
    }//GEN-LAST:event_jMenuItem21ActionPerformed


    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainProgram.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainProgram.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainProgram.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainProgram.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                // new MainProgram().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItemHienThi;
    private javax.swing.JLabel jLabeChucVu;
    private javax.swing.JLabel jLabeGioiTinh;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabelHoTen;
    private javax.swing.JLabel jLabelNgaySinh;
    private javax.swing.JLabel jLabelTen;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu9;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenu jMenuChiTietTau;
    private javax.swing.JMenu jMenuDanhMuc;
    private javax.swing.JMenu jMenuDoanTau;
    private javax.swing.JMenu jMenuDoiTuong;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem18;
    private javax.swing.JMenuItem jMenuItem19;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem21;
    private javax.swing.JMenuItem jMenuItem22;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem55;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JMenuItem jMenuItemBanVe;
    private javax.swing.JMenuItem jMenuItemBaoCao;
    private javax.swing.JMenuItem jMenuItemTraCuu;
    private javax.swing.JMenuItem jMenuKhachHang;
    private javax.swing.JMenuItem jMenuQuiDinh;
    private javax.swing.JMenuItem jMenuVe;
    public static javax.swing.JPanel jPanelHeThong;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JLabel lbtime;
    private javax.swing.JPanel pnlLogin;
    private javax.swing.JTabbedPane tabmain;
    // End of variables declaration//GEN-END:variables
}
